package com.foreknow.controller;

import com.foreknow.model.GuestBook;
import com.foreknow.service.GuestBookService;
import com.foreknow.service.impl.GuestBookServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;

public class ShowMessageServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
//        //服务器端向客户端响应的内容的类型（MIME）
//        resp.setContentType("text/html;charset=utf-8");
//        //设置客户端向服务器端发送请求的字符编码集
//        req.setCharacterEncoding("utf-8");
//        PrintWriter out = resp.getWriter();
//
//        GuestBookService service = new GuestBookServiceImpl();
//        List<Object> list = service.gQuery();
//
//        //要将list集合在服务器端保存（后端就可以在页面中获取到list集合)
//        req.setAttribute("list",list);
//        //将资源转发到list.jsp
//        req.getRequestDispatcher("/list.jsp").forward(req,resp);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doGet(req,resp);
    }
}
